﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Collections.Generic;

namespace YXShop.Web.admin.store
{
    public partial class storeanswer_edit : System.Web.UI.Page
    {
        YXShop.BLL.Store.Store storeBll = new YXShop.BLL.Store.Store();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                YXShop.Common.PromptInfo.Popedom("014005005");
            }
        }


        #region 保存数据
        protected void btnSave_Click(object sender, EventArgs e)
        {
            Save();
        }


        private void Save()
        {
            int askid = ChangeHope.WebPage.PageRequest.GetQueryInt("askid");
            if (askid > 0)
            {
                YXShop.Model.Admin.AdminInfo admin=YXShop.Common.AdministrorManager.Get();
                YXShop.BLL.Store.StoreAnswer answerBLL = new BLL.Store.StoreAnswer();
                YXShop.Model.Store.StoreAnswer answer = new Model.Store.StoreAnswer();
                answer.AskId = askid;
                answer.AnswerId = admin.AdminId;
                answer.AnswerTime = DateTime.Now;
                answer.Message = txtMessage.Value;
                answerBLL.Add(answer);

                YXShop.BLL.Store.StoreAsk askBLL = new BLL.Store.StoreAsk();
                YXShop.Model.Store.StoreAsk ask = askBLL.GetModelById(askid);
                ask.Answercount = ask.Answercount + 1;
                askBLL.Update(ask);
                Response.Redirect("storeask_view.aspx?id=" + askid.ToString());

            }
            
            

        }
        #endregion



    }
}
